using System.Linq;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Entities;

namespace Acme.BookStore.Repositories
{
    /// <summary>
    /// 仓储扩展方法
    /// </summary>
    public static class RepositoryExtensions
    {
        /// <summary>
        /// 获取仓储的可查询对象
        /// </summary>
        /// <typeparam name="TEntity">实体类型</typeparam>
        /// <typeparam name="TKey">主键类型</typeparam>
        /// <param name="repository">仓储</param>
        /// <returns>可查询对象</returns>
        public static IQueryable<TEntity> GetQueryable<TEntity, TKey>(this IRepository<TEntity, TKey> repository)
            where TEntity : class, IEntity<TKey>
        {
            return repository.WithDetails().AsQueryable();
        }
    }
} 